﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JTicket.BLL;

namespace JTicket.UI
{
    public partial class JT_CardInMoney : RoleBase
    {
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            string OperCode = bllOper.Oper().OperCode;
            string result = DAL.D_KaInfo.KaOperate(this.t1.Text, this.t6.Text, this.t5.Text, OperCode, "", "", "", "", "", "卡充值"); 
            this.Label1.Text = "找零：" + Convert.ToString(Convert.ToInt32(this.t5.Text) - Convert.ToInt32(this.t6.Text));
            this.t5.Text = "0";
            this.t6.Text = "0";
            if (t1.Text != "")
            {
                Model.D_KaInfo ka = DAL.D_KaInfo.GetModel(this.t1.Text);
                if (ka.pusername != null)
                {
                    this.t2.Text = ka.pusername;
                    this.t3.Text = ka.pusertel;
                    this.t4.Text = ka.puserid;
                    this.Label2.Text = ka.allamt.ToString();
                } 
            }
            Common.JsMsg.Alert(result);  
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string str = Printer.CardBusiness.GetCadID();
            if (str != "系统未连接读卡器")
            {
                this.t1.Text = str;
                if (t1.Text != "")
                {
                    Model.D_KaInfo ka = DAL.D_KaInfo.GetModel(this.t1.Text);
                    if (ka.pusername != null)
                    {
                        this.t2.Text = ka.pusername;
                        this.t3.Text = ka.pusertel;
                        this.t4.Text = ka.puserid;
                        this.Label2.Text = ka.allamt.ToString();
                    }
                    else
                        Common.JsMsg.Alert("未查询到卡信息");
                }
            }
            else
                Common.JsMsg.Alert("系统未连接读卡器");
        }
    }
}